import axios from "axios";
/**
 * 用户登录判断
 * @param {*} user
 */
const baseURL = "http://friday.nat100.top";
// const baseURL = 'http://101.34.50.31:8080';
export function loginApi(loginInfo) {
  return axios.get(`${baseURL}/login`, {
    params: {
      id: loginInfo.id,
      password: loginInfo.password,
    },
  });
}

/**
 * 详情
 * @param {*} id
 */
export function Inquirydetail(id) {
  return axios.get(`${baseURL}/inquiryDetail`, {
    params: { id: id },
  });
}
export function Orderdetail(id) {
  return axios.get(`${baseURL}/orderDetail`, {
    params: { id: id },
  });
}
export function Quotationdetail(id) {
  return axios.get(`${baseURL}/quotationDetail`, {
    params: { id: id },
  });
}
export function Productdetail(id) {
  return axios.get(`${baseURL}/productDetail`, {
    params: { id: id },
  });
}
export function invoiceDetail(id) {
  return axios.get(`${baseURL}/invoiceDetail`, {
    params: {
      order_id: id,
    },
  });
}
/**
 * 获取列表
 */
export function Inquirylist() {
  return axios.get(`${baseURL}/inquiryList`);
}
export function Employeelist() {
  return axios.get(`${baseURL}/employeeList`);
}
export function Productlist() {
  return axios.get(`${baseURL}/productList`);
}
export function Orderlist() {
  return axios.get(`${baseURL}/orderList`);
}
export function Quotationlist() {
  return axios.get(`${baseURL}/quotationList`);
}
export function Deliverylist() {
  return axios.get(`${baseURL}/deliveryList`);
}
export function Agentlist() {
  return axios.get(`${baseURL}/agentList`);
}
export function Companylist() {
  return axios.get(`${baseURL}/companyList`);
}
export function Orderemployeelist() {
  return axios.get(`${baseURL}/orderEmployeeList`);
}
export function Plantlist() {
  return axios.get(`${baseURL}/plantList`);
}
// 用于拿到询价单的商品信息
export function Inquiryproductlist(id) {
  return axios.get(`${baseURL}/inquiryProductList`, {
    params: { id: id },
  });
}
export function Inquirymatch(id, authority) {
  return axios.get(`${baseURL}/inquiryMatch`, {
    params: { id: id, authority: authority },
  });
}
export function Quotationmatch(id, authority) {
  return axios.get(`${baseURL}/quotationMatch`, {
    params: { id: id, authority: authority },
  });
}
export function Goodsplantlist(id) {
  return axios.get(`${baseURL}/goodsPlantList`, {
    params: { id: id },
  });
}
export function Deliveryrecordlist(id) {
  return axios.get(`${baseURL}/deliveryRecordList`, {
    params: { id: id },
  });
}
export function OrderInvoiceList() {
  return axios.get(`${baseURL}/orderInvoiceList`);
}
export function Matchcompanylist(id, authority) {
  return axios.get(`${baseURL}/matchCompanyList`, {
    params: { id: id, authority: authority },
  });
}
export function Productonsalelist() {
  return axios.get(`${baseURL}/productOnsaleList`);
}

/**
 * 删除
 * @param {*} id
 * @returns
 */
export function Employeedelete(id) {
  return axios.get(`${baseURL}/employeeDelete`, {
    params: { id: id },
  });
}
export function Productdelete(id) {
  return axios.get(`${baseURL}/productDelete`, {
    params: { id: id },
  });
}
export function Inquirydelete(id) {
  return axios.get(`${baseURL}/inquiryDelete`, {
    params: { id: id },
  });
}
export function Orderdelete(id) {
  return axios.get(`${baseURL}/orderDelete`, {
    params: { id: id },
  });
}
export function Quotationdelete(id) {
  return axios.get(`${baseURL}/quotationDelete`, {
    params: { id: id },
  });
}
export function Deliverydelete(id) {
  return axios.get(`${baseURL}/deliveryDelete`, {
    params: { id: id },
  });
}
export function Agentdelete(id) {
  return axios.get(`${baseURL}/agentDelete`, {
    params: { id: id },
  });
}
export function Companydelete(id, authority) {
  return axios.get(`${baseURL}/companyDelete`, {
    params: { id: id, authority: authority },
  });
}
/**
 * 新建
 * @returns result xxx_id
 */
export function Employeeadd(employee) {
  return axios.post(`${baseURL}/employeeAdd`, employee);
}
export function Productadd(product) {
  return axios.post(`${baseURL}/productAdd`, product);
}
export function Orderadd(order) {
  return axios.post(`${baseURL}/orderAdd`, order);
}
export function Deliveryadd(delivery) {
  return axios.post(`${baseURL}/deliveryAdd`, delivery);
}
export function Agentadd(agent) {
  return axios.post(`${baseURL}/agentAdd`, agent);
}
export function Companyadd(company) {
  return axios.post(`${baseURL}/companyAdd`, company);
}
export function Quotationadd(quotation) {
  return axios.post(`${baseURL}/quotationAdd`, quotation);
}
export function Deliveryrecordadd(e) {
  return axios.post(`${baseURL}/deliveryRecordAdd`, e);
}

/**
 * 修改信息
 */
export function Employeeedit_password(id, password) {
  return axios.get(`${baseURL}/emPwdEdit`, {
    params: {
      id: id,
      password: password,
    },
  });
}
export function Employeeedit(employee) {
  return axios.post(`${baseURL}/employeeEdit`, employee);
}
export function Productedit(product) {
  return axios.post(`${baseURL}/productEdit`, product);
}
export function Orderedit(order) {
  return axios.post(`${baseURL}/orderEdit`, order);
}
export function Quotationedit(quotation) {
  return axios.post(`${baseURL}/quotationEdit`, quotation);
}
export function Deliveryedit(quotation) {
  return axios.post(`${baseURL}/deliveryEdit`, quotation);
}
export function Agentedit(agent) {
  return axios.post(`${baseURL}/agentEdit`, agent);
}
export function Companyedit(company) {
  return axios.post(`${baseURL}/companyEdit`, company);
}

export function PlantDetail(plantid) {
  return axios.get(`${baseURL}/plantDetail`, {
    params: { id: plantid },
  });
}
export function DeliveryOrder(delivery) {
  return axios.get(`${baseURL}/deliveryDetail`, {
    params: {
      id: delivery,
    },
  });
}
export function Deliveryconfirm(id, operator_id) {
  return axios.get(`${baseURL}/deliveryConfirm`, {
    params: {
      order_id: id,
      operator_id: operator_id,
    },
  });
}

export function Deliveryrecordsend(id) {
  return axios.get(`${baseURL}/deliveryRecordSend`, {
    params: {
      id: id,
    },
  });
}
export function Ordersend(id) {
  return axios.get(`${baseURL}/orderSend`, {
    params: {
      id: id,
    },
  });
}
export function Invoiceadd(id) {
  return axios.get(`${baseURL}/invoiceAdd`, {
    params: {
      id: id,
    },
  });
}
export function quotationAddNoRef(quotation) {
  return axios.post(`${baseURL}/quotationAddNoRef`, quotation);
}
export function Quotationsend(id) {
  return axios.get(`${baseURL}/quotationSend`, {
    params: {
      id: id,
    },
  });
}
export function employeeAvatarEdit(formData) {
  return axios.post(`${baseURL}/employeeAvatarEdit`, formData, {
    "Content-Type": "multipart/form-data",
  });
}
export function productImgEdit(formData) {
  return axios.post(`${baseURL}/productImgEdit`, formData, {
    "Content-Type": "multipart/form-data",
  });
}
